package com.zwy.alhorthms;

/**
 * 选择排序
 * @author 天火
 * @className SelectionSort
 */
public class SelectionSort {

    public static void main(String[] args) {

    }
    static void swap ( int[] arrs, int i, int j){
        int temp = arrs[i];
        arrs[i] = arrs[j];
        arrs[j] = temp;
    }

    static void sort(int[] arr){

        for (int j = 0; j < arr.length - 1; j++) {
            int minPox = j;

            for (int i = j + 1; i < arr.length; i++) {
                minPox = arr[minPox] > arr[i] ? i : minPox;
            }
            swap(arr, minPox, j);
        }

    }
}
